package com.dstation.controller;

import com.alibaba.fastjson.JSONObject;
import com.dstation.domain.RecommendInfo;
import com.dstation.domain.UserInfo;
import com.dstation.service.interf.IRecommendService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;
import java.util.List;

@Controller
@RequestMapping(value = "rec")
public class RecommendController {

    @Resource
    private IRecommendService recommendService;


    @RequestMapping(value = "recommend")
    public JSONObject  pushRecommendVideo(HttpSession httpSession){
        JSONObject jsonObject =new JSONObject();
        UserInfo userInfo=(UserInfo) httpSession.getAttribute("userInfo");
        if(userInfo==null){
            return jsonObject;
        }
        List<RecommendInfo> allRecommend = recommendService.findAllRecommend();

        jsonObject.put("allRecommend",allRecommend);
        return jsonObject;

    }
}
